<?php
/* @var $this AdmRoleController */
/* @var $model AdmRole */
/* @var $form CActiveForm */
//当前操作
$actions = empty($model->actions)?array():CHtml::listData($model->actions,'child','child');
//print_r($actions);exit;
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'adm-role-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array('class'=>'create_role set_authority'),
)); ?>
<ul class="form_list form_list2">
	<li class="c_f"><span class="tit">角色名称：</span>
		<div class="cont f_l">
			<?php echo $form->textField($model,'zao_title',array('class'=>'t_ipt ipt_bg w_250'))?>
			<?php echo $form->error($model,'zao_title')?>
		</div>
	</li>
	<li class="c_f"><span class="tit">角色说明：</span>
		<div class="cont f_l">
			<?php echo $form->textArea($model,'zao_content',array('cols'=>'100','rows'=>'5'))?>
			<?php echo $form->error($model,'zao_content')?>
		</div>
	</li>
	<li class="c_f"><span class="tit">角色权限：</span>
		<div class="cont f_l">
			<ul class="main_list ">
				<?php  $tasks = AdmGroup::model()->getPrivilege();?>
				<?php 	foreach($tasks as $key=>$val){ ?>
				<li class="item">
						<?php echo CHtml::label($val,'') ?>
						<?php echo CHtml::checkBoxList("privilege[$key][]",isset($actions)?$actions:'',AdmGroup::model()->getTaskAction($key),array('checkAll'=>'all','container'=>'ul','separator'=>'','template'=>'<li>{input} {label}</li>','containerClass'=>'subsub_list c_f'));?>
				</li>
				<?php }?>	
			</ul>
		</div>
	</li>
	<li class="c_f"><span class="tit">&nbsp;</span>
		<div class="cont f_l">
			<?php echo CHtml::submitButton(Yii::t('adm','Save Date'),array('class'=>'mem_btn mem_btn20 mr5')); ?>
			<?php echo CHtml::resetButton(Yii::t('adm','Reset'),array('class'=>'mem_btn mem_btn07 mr5')); ?>
		</div>
	</li>
</ul>


<?php $this->endWidget(); ?>

</div><!-- form -->
<script type="text/javascript">
$(function(){
	$('.subsub_list').each(function(){
			//alert($(this).find('li').length);
			$(this).find('li').first().addClass("check_all");
	 });
});
</script>